<?

require_once("../include/class/FPDF.class.php");

class PDFFactory extends FPDF{

var $query;
var $variable=array();

function PDFFactory(){
	$this->FPDF();
}


function Header()
{
	global $title;

	//Arial bold 12
	$this->SetFont('Arial','B',12);
	//Calculate width of title and position
	$w=$this->GetStringWidth($title)+100;
	$this->SetX((210-$w)/2);
	//Colors of frame, background and text
	$this->SetDrawColor(0,0,255);
	$this->SetFillColor(200,220,255);
	$this->SetTextColor(0,00,102);
	//Thickness of frame (1 mm)
	$this->SetLineWidth(1);
	//Title
	$this->Cell($w,9,$title,1,1,'C',1);
	//Line break
	$this->Ln(10);
}

function Footer()
{
	//Position at 1.5 cm from bottom
	$this->SetY(-15);
	//Arial italic 8
	$this->SetFont('Arial','I',6);
	//Text color in gray
	$this->SetTextColor(128);
	//Page number
	$this->Cell(0,10,'Page '.$this->PageNo(),0,0,'C');
	$this->SetY(-18);
	//Arial italic 8
	$this->SetFont('Arial','I',6);
	//Text color in gray
	$this->SetTextColor(128);
	//Page number
	$this->Cell(0,10,"source : ".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'],0,0,'C');	
}

function ChapterTitle($label,$date,$author)
{
	//Arial 12
	$this->SetFont('Arial','B',11);
	//Background color
	$this->SetFillColor(200,220,255);
	//Title
	$this->Cell(0,6,ucwords($label),0,1,'L',1);
	//Line break
	$this->Ln(0);
	$content=($author!=""?"By ".$author.", ":"");
	$content.="Posted on ".$date; 
	$this->SetFont('Arial','I',9);
	$this->Cell(0,6,$content,0,1,'L',1);
	$this->Ln(4);
}



function ChapterBody($text)
{
	
	//Times 12
	$this->SetFont('arial','',10);
	//Output justified text
	$this->MultiCell(0,5,"       ".ucfirst($text));
	//Line break
	$this->Ln(4);
	//Mention in italics
}

function PrintChapter($title,$text,$date,$author)
{
	$this->AddPage();
	$this->ChapterTitle($title,$date,$author);
	$this->ChapterBody($text);
}



}
?>